package com.moralesce.gt.concurrency;

import static java.util.concurrent.TimeUnit.SECONDS;

import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;

class TaskExecutorImpl implements TaskExecutor {

	private final ThreadPoolExecutor executor = new ThreadPoolExecutor(20, 20, 120, SECONDS, new LinkedBlockingQueue<Runnable>());

	public TaskExecutorImpl() {
		executor.prestartAllCoreThreads();
	}

	public void execute(Runnable command) {
		executor.execute(command);
	}

	public int getActiveCount() {
		return executor.getActiveCount();
	}

	public long getTaskCount() {
		return executor.getTaskCount();
	}

	public long getCompletedTaskCount() {
		return executor.getCompletedTaskCount();
	}

	public void shutdown() {
		executor.shutdown();
	}

	public List<Runnable> shutdownNow() {
		return executor.shutdownNow();
	}

	public boolean isShutdown() {
		return executor.isShutdown();
	}

	public boolean isTerminating() {
		return executor.isTerminating();
	}

	public boolean isTerminated() {
		return executor.isTerminated();
	}

}
